package vn.com.pavibook.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import vn.com.pavibook.dao.BannerDao;
import vn.com.pavibook.domain.model.Banner;
import vn.com.pavibook.domain.model.PagingInfo;
import vn.com.pavibook.domain.model.SearchResult;
import vn.com.pavibook.utils.DataHelper;


@Service
public class BannerService {
	
	@Autowired
	private BannerDao bannerDao;
	
	public SearchResult<Banner> getBannerTop(){
		SearchResult<Banner> result = new SearchResult<Banner>();
		result = bannerDao.getBannerByType(new PagingInfo(10, 1), DataHelper.TypeBanner.TYPE_BANNER_BANNER.getCode());
		return result;
	}
	
	public SearchResult<Banner> getAdvertising(){
		SearchResult<Banner> result = new SearchResult<Banner>();
		result = bannerDao.getBannerByType(new PagingInfo(10, 1), DataHelper.TypeBanner.TYPE_BANNER_ADVERTISING.getCode());
		return result;
	}
	
	public Banner getBannerDetail(int bannerId) {
		return bannerDao.getBannerDetail(bannerId);
	}
}
